<?php

/*
  This file creates the settings tab
*/

global $wpdb, $table_prefix;
require_once(ABSPATH . 'wp-admin/upgrade-functions.php'); 
include_once("uploader_functions.php");

//funtion to create the default value of pages to display per page in the "files" page
function installFO(){
  delete_option('wp-uploader-number-of-files-per-page-on-front-office-search');
  add_option('wp-uploader-number-of-files-per-page-on-front-office-search', 5);
}

if($_REQUEST["mode"]=='update' && isset ($_POST['numberOfFiles'])){
  $number = $_POST['numberOfFiles'];
  update_option('wp-uploader-number-of-files-per-page-on-front-office-search', $number);
  $Message = "Number of files to display, per page, was updated to $number.";
 
}
$valuePages = get_option('wp-uploader-number-of-files-per-page-on-front-office-search');

    
if ($Message){
  echo "<div id='message' class='updated fade'>";
  echo "<p><strong>".$Message."</strong></p>";
  echo "</div>";
}

?>
<div class="wrap" id="numberOfFiles">
  <h2>Files per Page on Front Office Search </h2>
  <form name="numberOfFile" id="numberOfFile" action="?page=wp-uploader/frontOfficeConfig.php&amp;mode=update" method="post">
    <table>
      <tr>
        <td>          Select the number of files to display per page:          &nbsp; &nbsp;
        </td>
        <td>
          <select name="numberOfFiles">
          
          <option value="5" <? if( $valuePages == 5 ) echo "SELECTED" ?> >
          5 
          </option>
          <option value="10" <? if( $valuePages == 10 ) echo "SELECTED" ?> >
          10
          </option>
          <option value="15" <? if( $valuePages == 15 ) echo "SELECTED" ?> >
          15        
          </option>
          </select>
        </td>
      </tr>
    </table>
    <div class="submit" align=right>
      <input type="submit" name="value" value="<?php _e('Update', 'update') ?>"/>
    </div>
  </form>
</div>

<div class="wrap" id="howTo">
  <h2>Creating Front Office Front Page </h2>
 
  
First create a page and place <input READONLY style="width: 13em" value="&lt;!--wp_uploader_FO--&gt; " /> in the page body (in HTML mode).
</div>
